Package-level declarations

Lock-free composable transactional primitives built on Arrow STM: StmCounter, StmGauge, StmStateMachine, StmSemaphore, StmRateWindow, and TVar extension functions.

Types

Link copied to clipboard

STM-based counter that can be atomically incremented/decremented.

Link copied to clipboard
class StmGauge

STM-based gauge that tracks a current value with min/max bounds.

Link copied to clipboard

STM-based rate tracking window for sliding window rate limiting.

Link copied to clipboard

STM-based semaphore for concurrency limiting using transactional memory.

Link copied to clipboard

STM-based state machine with typed states and atomic transitions.

Functions

Link copied to clipboard
suspend fun <R> stmTransaction(block: STM.() -> R): R

Executes multiple STM operations atomically.

Link copied to clipboard
suspend fun <A, R> withTVar(initial: A, block: STM.(TVar<A>) -> R): R

Creates a TVar with initial value and immediately uses it in a transaction.

Inherited functions

Link copied to clipboard
suspend fun <A> TVar<A>.compareAndSet(expected: A, new: A): Boolean

Atomically updates the TVar only if the current value matches expected.

Link copied to clipboard
suspend fun <A> TVar<A>.getAndSet(value: A): A

Atomically reads the current value and replaces it with value.

Link copied to clipboard
suspend fun <A> TVar<A>.modify(f: (A) -> A): A

Atomically reads and updates a TVar using the given function f.